import { consulateHttp, validatorHttp } from '../index';
import qs from 'qs'

export function validModifyState(data: { id: string }) {
  const fromData = new FormData()
  fromData.append('id', data.id)
  console.log('%c [ data ]-3', 'font-size:13px; background:pink; color:#bf2c9f;', data)
  return consulateHttp.request({
    method: 'POST',
    url: '/validExclude/modifyState',
    data: fromData
  });
}
interface ValidInfos {
  validId: string,
  validRemark: string
}
interface ValidExclude {
  hospId: string,
  hospName: string,
  validInfos: Array<ValidInfos>
}
export function validExcludeSave(data: ValidExclude) {
  return consulateHttp.request({
    method: 'POST',
    url: '/validExclude/save',
    data
  });
}
interface ValidPatient {
  sex: string,
  excludeWord: string,
  remark: string,
  warnLevel: string,
  ageUnit: string,
  minAge: number | null,
  maxAge: number | null,
  warnMsg: string,
  score: number
}
export function validPatientSave(data: ValidPatient) {
  return validatorHttp.request({
    method: 'POST',
    url: '/manage/validPatient/save',
    data: qs.stringify(data)
  });
}
interface ValidMutual {
  see: string,
  diagnosis: string,
  remark: string,
  warnLevel: string,
  bothSentence: string,
  itemName: string,
  warnMsg: string,
  score: number
}
export function mutualExclusionSave(data: ValidMutual) {
  return validatorHttp.request({
    method: 'POST',
    url: '/manage/section/mutualExclusion/save',
    data: qs.stringify(data)
  });
}
interface SectionFormat {
  illegalChar: string,
  forbiddenPosition: string,
  remark: string,
  warnLevel: string,
  warnMsg: string,
  score: number
}
export function sectionFormatSave(data: ValidMutual) {
  return validatorHttp.request({
    method: 'POST',
    url: '/manage/section/format/save',
    data: qs.stringify(data)
  });
}
interface SectionValue {
  symbol: string,
  before: string,
  number: string,
  regEx: string,
  min: null | number,
  max: null | number,
  remark: string,
  warnLevel: string,
  warnMsg: string,
  score: number
}
export function sectionValueSave(data: SectionValue) {
  return validatorHttp.request({
    method: 'POST',
    url: '/manage/section/value/save',
    data: qs.stringify(data)
  });
}

interface SensitiveWord {
  words: string,
  remark: string,
  warnLevel: string,
  warnMsg: string,
  score: number
}
export function sensitiveWordSave(data: SensitiveWord) {
  return validatorHttp.request({
    method: 'POST',
    url: '/manage/sensitive/save',
    data: qs.stringify(data)
  });
}